<template>
    <div>
        
        {{showlist}}
        <br>
        <van-field  label="课程" placeholder="请输入课程" v-model="coursename" />
        <br>
        展示图片：
        <van-image
            width="100"
            height="100"
            :src= imgurl
        />
        <br>
        头像上传:
        <van-uploader :after-read="getnewshow" />
    </div>
</template>

<script>
    export default {
        data(){
            return{
                showlist:[],
                coursename:'',
                imgurl:''
            }
        },
        methods: {
            //添加图片和课程表
            getnewshow(file){
                
                let form = new FormData()
                form.append('name',this.coursename)
                form.append('img',file.file)
                console.log(form)
                this.$axios.post('users/newshow/',form).then(res=>{

                    
                })
            },
            //展示图片
            getimg(){
                this.$axios.get('users/newshow/').then(res=>{
                    this.showlist = res.data.list
                    this.img_src =this.upload_dir+res.data.list.img
                    
                })
            }
        },
        mounted() {
            this.getimg
        },
    }
</script>

<style scoped>

</style>